package com.qys.livesMall.system.enums.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qys.livesMall.system.enums.dao.H2TemplateDao;
import com.qys.livesMall.system.model.entity.template.H2Template;
import com.qys.livesMall.system.mapper.H2TemplateMapper;
import org.springframework.stereotype.Service;
import java.util.List;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wzy
 * @since 2023-04-27
 */
@Service
public class H2TemplateDaoImpl extends ServiceImpl<H2TemplateMapper, H2Template> implements H2TemplateDao {


    @Override
    public H2Template getByCode(String code) {
        LambdaQueryWrapper<H2Template> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(H2Template::getCode,code);
        wrapper.eq(H2Template::getStatus,1);
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    @Override
    public List<H2Template> getByType(String type) {
        LambdaQueryWrapper<H2Template> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(H2Template::getType,type);
        wrapper.eq(H2Template::getStatus,1);
        return this.list(wrapper);

    }
}
